{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Device Enrolement Request",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "identifier" : {
      "type" : "integer",
      "description" : "Unique identifier for each file that is produced or processed by CMP"
    },
    "version" : {
      "type" : "number",
      "minimum" : 1.0,
      "maximum" : 1.0,
      "description" : "The current version of the generic extract file. This must match the corresponding inbound file."
    },
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Device Enrolment" ],
      "description" : "CMP categorisation of the job associated with this file"
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Device Enrolment Request" ],
      "description" : "Sub-categorisation of the job"
    },
    "batchDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a batch was created in CMP"
    },
    "extractLoadDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Timestamp indicating when the generic extract file was created."
    },
    "recordCount" : {
      "type" : "integer",
      "minimum" : 0,
      "description" : "Total number of transaction records in the extract file. "
    },
    "deviceEnrolmentProviderId" : {
      "type" : "string",
      "description" : "This indicates the manufacturer Id which uniquely identifier the manufacturer that this Device Enrolment request is for."
    },
    "orders" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/DeviceEnrolementRequestOrders"
      }
    }
  },
  "required" : [ "identifier", "version", "interfaceCategory", "interfaceType", "batchDateTime", "extractLoadDateTime", "recordCount", "deviceEnrolmentProviderId", "orders" ],
  "definitions" : {
    "DeviceEnrolementRequestOrders" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "id" : {
          "type" : "integer",
          "description" : "This is the unique identifier of the order that the devices are associated with."
        },
        "requestType" : {
          "type" : "string",
          "enum" : [ "RETURN", "ORDER", "VOID", "OVERRIDE" ],
          "description" : "This is indicates the type of request. It can be one of Return, Order, void or an override."
        },
        "generatedDateTime" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "This is the time that the order was generated in CMP which in effect is the time that the sale was finalised."
        },
        "externalOrderId" : {
          "type" : "string",
          "description" : "This represents the order number that is returned from the warehouse in the Order Dispatch Response."
        },
        "customerDEPId" : {
          "type" : "string",
          "description" : "This represents the Id by which the customer is known as by the Device Manufacturer that we are trying to enrol the device with."
        },
        "customerReference" : {
          "type" : "string",
          "description" : "This could be used for storing a PO Number"
        },
        "shipmentDate" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "This is the date that the warehouse indicated that the order was dispatched"
        },
        "devices" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/DeviceEnrolementRequestDevices"
          }
        }
      },
      "required" : [ "id", "requestType", "generatedDateTime", "externalOrderId", "customerDEPId", "customerReference", "devices" ]
    },
    "DeviceEnrolementRequestDevices" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "deviceId" : {
          "type" : "string",
          "description" : "This contains the device Id of the device."
        },
        "manufacturer" : {
          "type" : "string",
          "description" : "This contains the manufacturer of the device."
        },
        "assetTag" : {
          "type" : "string",
          "description" : "This contains the asset Tag of the device."
        }
      },
      "required" : [ "deviceId" ]
    }
  }
}